package com.lingxu.module.message.controller;

import com.lingxu.base.common.api.vo.Result;
import com.lingxu.module.message.service.MessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Title: MessageController
 * @Package: com.lingxu.module.message.controller
 * @Author: ysj闫世杰
 * @Email: 1105324813@qq.com
 * @Date: Created in 2023/8/17 12:48
 * @Description: 用户申请审批消息
 * @Version: 1.0.0
 */
@RestController
@RequestMapping(value = "/message")
public class MessageController {

    @Autowired
    private MessageService messageService;

    /**
     * @Author ysj闫世杰
     * @Description 查询未读消息
     * @Date 2023/8/28 9:42
     * @Param: userId
     * @return com.lingxu.base.common.api.vo.Result
     **/
    @RequestMapping(value = "/findUnReadMessage")
    public Result findUnReadMessage(String userId){
        return messageService.findUnReadMessage(userId);
    }


    /**
     * @Author ysj闫世杰
     * @Description 消息已读
     * @Date 2023/8/28 14:13
     * @Param: ids
     * @return com.lingxu.base.common.api.vo.Result
     **/
    @RequestMapping(value = "/updateRead")
    public Result updateRead(@RequestBody List<String> ids){
        return messageService.updateRead(ids);
    }
}
